package com.duobao.server;

public class Difu extends Map implements Runnable{

    public Difu() {
        super(-1, "地府",null, false, "死亡的NPC所在地", null);
    }
    public void run()
    {

        while(true)
        {
            int size=this.getNpcs().size();
            System.out.println("地府鬼魂:"+size);
            for(int i=0;i<size;i++)
            {

                NPC npc1=this.getNpcs().get(size-i-1);
                if(System.currentTimeMillis() - npc1.getSwTime()>=4*60000)
                {
                    System.out.println(npc1.getName()+"的复活地是："+npc1.getLocation());
                    npc1.hufouhuofu();
                    npc1.setSiwang(false);
                    Map map=Maps.getMap(npc1.getChushiMap());
                    map.getNpcs().add(npc1);
                    this.getNpcs().remove(npc1);
                }

            }
            try {
                Thread.sleep(1*60000);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

        }
    }
}
